package com.m3958.firstgwt.server.model;

import java.util.UUID;

import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Query;
import javax.persistence.Table;

import net.sf.json.JSONObject;

@Entity
@Table(name="PERSISTED_LOGIN")
@AttributeOverride(name="id",column=@Column(nullable = false,name="PERSIST_LOGIN_ID"))
public class PersistedLogin extends BaseModel<PersistedLogin>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public JSONObject toJson(){
		return JSONObject.fromObject(this);
	}
	
	public PersistedLogin(){}
	
	public PersistedLogin(String email){
		this.loginName = email;
		this.seriesNum = UUID.randomUUID().toString()+UUID.randomUUID().toString();
		this.token = UUID.randomUUID().toString()+UUID.randomUUID().toString();
	}
	
	
	private String loginName;
	
	private String seriesNum;
	
	private String token;

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getSeriesNum() {
		return seriesNum;
	}

	public void setSeriesNum(String seriesNum) {
		this.seriesNum = seriesNum;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

}
